package com.wuzheng.wisgo.sanitation.cloud.repository.builder.tbox;

import com.wuzheng.wisgo.sanitation.framework.util.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.jdbc.SQL;

/**
 * @author：sp
 * @date：Created in 2019/10/10
 * @description：构建sql
 * @modified By：
 * @version: 1.0
 */
public class SelectVehCodeToReceiveInfoBuilder {

    /*
     * @MethodName: builderSelectVehCodePListSql
     * @Description: 轨迹回放，搜索框信息车牌号查询
     * @Param: [vehCode,customerId]车牌号，组织编码
     * @Return: java.lang.String
     * @Author: sunpeng
     * @Date: 2019/10/10
    **/
    public String builderSelectVehCodePListSql(@Param("vehCode") String vehCode,@Param("customerId") String customerId ) {
        return new SQL() {
            {
                SELECT(" DISTINCT veh.veh_code,veh.veh_vin_code ");
                FROM("ba_vehicle AS veh");
                WHERE("veh.customer_id = #{customerId}");
                if (StringUtils.isNotEmpty(vehCode)) {
                    WHERE("veh.veh_code LIKE CONCAT('%', #{vehCode}, '%')");
                }
            }
        }.toString();
    }
}
